home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2819 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1007 b 

  1. Path: news.tu-chemnitz.de!news
  2. From: hfst@hrz.tu-chemnitz.de (Hans Steffani)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: sscanf problems
  5. Date: 24 Jan 96 08:09:57 GMT
  6. Organization: University of Technology Chemnitz, FRG
  7. Message-ID: <4e4qf8$rea@pyrrhus-f.hrz.tu-chemnitz.de>
  8. References: <4e4c2v$j2g@mathserv.mps.ohio-state.edu>
  9. NNTP-Posting-Host: prom.hrz.tu-chemnitz.de
  10.  
  11. Chris Mongold <cmongold@magnus.acs.ohio-state.edu> writes:
  12.  
  13. >#include <stdio.h>
  14.  
  15. >void main()
  16. >{
  17. >char input[20], crap[17], segment[6], seg_len[3], begin[3], load[3];
  18. >int type;
  19.  
  20. >sscanf(crap, "%d%3s%6s%3s%3s", type, begin, segment, seg_len, load);
  21.  
  22. You have to pass an pointer to an int instead the int variable
  23. itsself. 
  24.  
  25. The char arrays begin, seg_len and load need 4 elements to hold
  26. a 3 character long string and segment needs 7 to hold a 6
  27. element string.
  28.  
  29. h.f.s.
  30. PS:
  31. This is posted and mailed.
  32. --
  33. Hans Friedrich Steffani
  34. Institut fuer Elektrische Maschinen und Antriebe
  35. TU Chemnitz-Zwickau
  36. e-mail: hans.steffani@e-technik.tu-chemnitz.de
  37.